var t = require;
var e = module;
var o = exports;
var i, n = this && this.__extends || (i = function(t, e) {
    return (i = Object.setPrototypeOf || {
        __proto__: []
    }
    instanceof Array &&
    function(t, e) {
        t.__proto__ = e
    } ||
    function(t, e) {
        for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
    })(t, e)
},
function(t, e) {
    function o() {
        this.constructor = t
    }
    i(t, e),
    t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
}),
a = this && this.__decorate ||
function(t, e, o, i) {
    var n, a = arguments.length,
    r = a < 3 ? e: null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);
    else for (var s = t.length - 1; s >= 0; s--)(n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
    return a > 3 && r && Object.defineProperty(e, o, r),
    r
};
Object.defineProperty(o, "__esModule", {
    value: !0
});
var r = t("GameConstant"),
s = cc._decorator,
l = s.ccclass,
c = s.property,
d = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.rocket = null,
        e.par_fire = null,
        e.spine_jet = null,
        e.spine = null,
        e
    }
    return n(e, t),
    e.prototype.initItem = function(t, e, o, i, n) {
        var a = this;
        this.node.active = !0,
        this.node.position = i,
        this.node.angle = n,
        this.spine.node.active = !1,
        this.rocket.active = !0;
        var s = cc.v3(cc.winSize.width, 0, 0);
        if (e == r.Collide_Car_Tag.Right) {
            var l = Math.tan(n / Math.PI * 180 + 90),
            c = (1 - l) * -cc.winSize.width,
            d = -l * -cc.winSize.width;
            s = cc.v3(c, d, 0)
        }
        this.setScale(e == r.Collide_Car_Tag.Right, o);
        var h = n / 180 * Math.PI;
        this.node.scaleX >= 0 ? (c = cc.winSize.width * Math.cos(h), d = cc.winSize.width * Math.sin(h), this.par_fire.angle = -180, s = cc.v3(c, d, 0)) : (c = -cc.winSize.width * Math.cos(h), d = -cc.winSize.width * Math.sin(h), this.par_fire.angle = 0, s = cc.v3(c, d, 0));
        var p = cc.v3(this.node.position.x + s.x, this.node.position.y + s.y, this.node.position.z);
        this.rocket.getComponent(cc.Collider).tag = t,
        cc.tween(this.node).to(3, {
            position: p
        }).call(function() {
            a.node.destroy()
        }).start()
    },
    e.prototype.setScale = function(t, e) {
        var o = 1;
        o = r.Cur_Game_Type == r.Game_Type.PK ? r.Game_Type_Scale.PK: 1,
        o = e < 0 ? -o: o,
        this.node.scale = t ? -o: o
    },
    e.prototype.removeItem = function() {
        var t = this;
        this.node.stopAllActions(),
        this.rocket.active = !1,
        this.spine.node.active = !0,
        this.spine.setAnimation(0, "animation", !1),
        this.scheduleOnce(function() {
            t.node.destroy()
        },
        .5)
    },
    a([c(cc.Node)], e.prototype, "rocket", void 0),
    a([c(cc.ParticleSystem)], e.prototype, "par_fire", void 0),
    a([c(sp.Skeleton)], e.prototype, "spine_jet", void 0),
    a([c(sp.Skeleton)], e.prototype, "spine", void 0),
    a([l], e)
} (cc.Component);
o.default = d